#ifndef YIGLOGINMENU_H
#define YIGLOGINMENU_H

// System includes
#include <QWidget>
#include <QRadioButton>
#include <QLabel>
#include <QFormLayout>
#include <QHBoxLayout>
#include <QLineEdit>
#include <QPushButton>
#include <QDialog>

/**
*   LogInInformation
*   Struct containing the information from the log in menu
*/
struct LogInInformation {

    LogInInformation() : online(false), userName("User"), oscthulhuPort(32243) { }

    /** bool for the online status of the program */
    bool online;
    /** if online, the user name for the session */
    QString userName;
    int oscthulhuPort;
};

/**
*   YigLogInMenu
*   Starts Yig with the specified parameters, such as Online/Offline, user name, ip address etc...
*   Right now this is very simple but will be fleshed out more in the future, with saved information
*/
class YigLogInMenu : public QDialog
{
    Q_OBJECT

public:

    /**
    *   YigLogInMenu constructor
    *   @param LogInInformation the struct containing the log in information for this session
    *   @param QWidget Parent widget, should be 0 so that the window floats
    */
    explicit YigLogInMenu(LogInInformation* logIn, QWidget *parent = 0);

    /**
    *   YigLogInMenu deconstuctor
    */
    ~YigLogInMenu();

signals:

public slots:

private slots:

    /**
    *   sets the status of the online bool and toggles the radio buttons
    *   @param bool The new bool
    */
    void setOnline(bool online);

    /**
    *   sets the status of the online bool and toggles the radio buttons
    *   @param bool The new bool
    */
    void setOffline(bool offline);

    /**
    *   sets the user name of the program
    */
    void setUserName();

    /**
    *   Called when the user submits the contents of the menu, closing it and starting up the program
    */
    void submit();

    /**
    *Updates texts when nameEntry is updated
    **/
    void changeUserNameTextField(QString);

private:

    /** the layout of the menu */
    QFormLayout* formLayout;
    /** layout for the radio buttons */
    QHBoxLayout radioLayout;
    /** sets the online bool to true */
    QRadioButton onlineRadioButton;
    /** sets the online bool to false */
    QRadioButton offlineRadioButton;
    /** text entry for the user name */
    QLineEdit nameEntry;
    /** submit button for the menu */
    QPushButton submitButton;
    /** pointer to the online log in information that we use for our program*/
    LogInInformation* mLogIn;
    QString userNameTextField;
};

#endif // YIGLOGINMENU_H
